package com.lc.schedule.service.impl;

import com.lc.schedule.dao.SysUserDao;
import com.lc.schedule.dao.impl.SysUserDaoImpl;
import com.lc.schedule.pojo.SysUser;
import com.lc.schedule.service.SysUserService;
import com.lc.schedule.util.MD5Util;

/**
 * @author liuchun
 */
public class SysUserServiceImpl implements SysUserService {

    private SysUserDao userDao = new SysUserDaoImpl();
    @Override
    public int register(SysUser user) {
        //进行明文密码转密文
        String userPwd = user.getUserPwd();
        String NewPwd = MD5Util.encrypt(userPwd);
        user.setUserPwd(NewPwd);
        //调用dao层方法，将信息存入数据库
        return userDao.addSysUser(user);
    }

    @Override
    public SysUser findByUserName(String username) {
        //当前业务很简单，service层没有什么业务处理代码，这里直接调用dao层的方法
      return userDao.findByUserName(username);
    }
}
